import { BasicColumn } from '/@/components/Table';
import { h } from 'vue';
import { Select, Input } from 'ant-design-vue';

export const columns: BasicColumn[] = [
  {
    title: '按钮',
    dataIndex: 'newValue',
    key: 'newValue',
    width: 120,
  },
  {
    title: '启用',
    dataIndex: 'isDisplay',
    key: 'isDisplay',
    ellipsis: true,
    width: 100,
    customRender: ({ record }: any) => {
      //   if (!Reflect.has(record, 'pendingStatus')) {
      //     record.pendingStatus = false;
      //   }
      return h(Select, {
        options: [
          {
            label: '是',
            value: 'true',
          },
          {
            label: '否',
            value: 'false',
          },
        ],
        style: 'width:100%',
        value: record.isDisplay,
        getPopupContainer: () => document.body,
        onChange(value) {
          record.isDisplay = value;
        },
      });
    },
  },
  {
    title: '名称',
    dataIndex: 'value',
    key: 'value',
    customRender: ({ record }: any) => {
      return h(Input, {
        value: record['value'],
        onChange(e) {
          record['value'] = e.target.value;
        },
      });
    },
  },
  {
    title: '提示信息',
    dataIndex: 'title',
    key: 'title',
    customRender: ({ record }: any) => {
      return h(Input, {
        value: record['title'],
        onChange(e) {
          record['title'] = e.target.value;
        },
      });
    },
  },
];

export const dataSource = [
  {
    name: '是否启用',
    value: '',
  },
  {
    name: '邮箱服务器地址',
    value: '',
  },
  {
    name: '邮箱服务器端口',
    value: '',
  },
  {
    name: '邮箱登录账号',
    value: '',
  },
  {
    name: '邮箱登录密码',
    value: '',
  },
  {
    name: '邮箱地址',
    value: '',
  },
  {
    name: '是否采用SSL安全套接字连接',
    value: '',
  },
  {
    name: '邮箱服务器编码',
    value: '',
  },
];
